package com.wpml.search.api;

import com.wpml.common.util.ResultJson;
import com.wpml.search.vo.SkuEsModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(name = "search-service", fallback = SearchFeignClient.SearchFeignClientFallback.class)
public interface SearchFeignClient {

    @PostMapping("/search/saveProduct")
    ResultJson saveProduct(@RequestBody List<SkuEsModel> skuEsList);

    abstract class SearchFeignClientFallback implements SearchFeignClient{

        public ResultJson defaultFallback() {
            return ResultJson.fail("微服务调用异常，请联系管理员");
        }
    }
}
